<template>
    <div class="components-container">
        <!-- 编辑 -->
        <sweet-modal ref="dialog" class="dialog" :sweetModalMaxWidth="930">
            <h3>{{title}} </h3>
            <fieldset class="layui-elem-field layui-field-title">
                <legend>死者信息</legend>
                <div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">业务编号</label>
                        <div class="layui-input-inline">
                            <el-input v-model="ashUseData.REGBUSNUM" placeholder="请输入业务编号" @keyup.enter.native="getRegInfo">
                            <el-button slot="append" icon="el-icon-search" @click="getRegInfo"></el-button>
                            </el-input>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">逝者姓名</label>
                        <div class="layui-input-inline">
                            <el-input v-model="regList.REGNAME" readonly></el-input>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">性别</label>
                        <div class="layui-input-inline">
                            <el-input v-model="regList.REGSEXDESC" readonly></el-input>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">年龄</label>
                        <div class="layui-input-inline">
                            <el-input v-model="regList.REGAGE" readonly></el-input>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">证件号码</label>
                        <div class="layui-input-inline">
                            <el-input v-model="regList.REGCARDNO" readonly></el-input>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">逝者地址</label>
                        <div class="layui-input-inline">
                            <el-input v-model="regList.REGDETAILADDRESS" readonly style="width:480px;"></el-input>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item" v-if="IsShowRegcreurn&&!IslinRegcreurn">
                    <div class="layui-inline">
                        <label class="layui-form-label">骨灰盒</label>
                        <div class="layui-input-inline">
                            <el-input v-model="regList.REGCREURN" readonly></el-input>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item" v-if="IslinRegcreurn">
                    <div class="layui-inline">
                        <label class="layui-form-label">骨灰盒</label>
                        <div class="layui-input-inline">
                            <el-input v-model="regList.REGCREURN"></el-input>
                        </div>
                    </div>
                </div>
                <!-- <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">备注</label>
                        <div class="layui-input-inline">
                            <el-input v-model="regList.REGREMARK" readonly></el-input>
                        </div>
                    </div>
                </div> -->
                </div>
            </fieldset>
            <fieldset class="layui-elem-field layui-field-title">
                <legend>家属信息</legend>
                <div>
                    <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">家属姓名</label>
                        <div class="layui-input-inline">
                            <el-input v-model="regList.REGHANDLERNAME" readonly></el-input>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">联系电话</label>
                        <div class="layui-input-inline">
                            <el-input v-model="regList.REGHANDLERLINK" readonly></el-input>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">逝者关系</label>
                        <div class="layui-input-inline">
                            <el-input v-model="regList.REGRELATION" readonly></el-input>
                        </div>
                    </div>
                    </div>
                    <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">详细住址</label>
                        <div class="layui-input-inline">
                            <el-input v-model="regList.REGHANDLERHOUSEHOLD" readonly style="width:480px;"></el-input>
                        </div>
                    </div>
                    </div>
                <!-- <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">备注</label>
                        <div class="layui-input-inline">
                            <el-input type="textarea" v-model="ashUseData.ASHREMARKS" style="width:480px;"></el-input>
                        </div>
                    </div>
                </div> -->
                </div>
            </fieldset>
            <fieldset class="layui-elem-field layui-field-title">
                <legend>寄存堂信息</legend>
                <div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">寄存位置</label>
                        <div class="layui-input-inline">
                            <el-select filterable :disabled="selectstatus" v-model="ashUseData.ASSNO" placeholder="请选择寄存位置" style="width:100%" ref="select">
                                <el-option v-for="item in ashTypes" :key="item.value" :label="item.label" :value="item.value">
                                </el-option>
                            </el-select>
                        </div>
                        <div class="layui-input-inline" style="width:60px;">
                            <el-button type="primary" icon="el-icon-more" :disabled="selectstatus" @click="openchoosejct"></el-button>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">寄存卡号</label>
                        <div class="layui-input-inline">
                            <el-input v-model="ashUseData.ASHNUMBER" placeholder="请输入寄存卡号"></el-input>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">开始日期</label>
                        <div class="layui-input-inline">
                            <el-date-picker v-model="ashUseData.ASHBEGDATE" type="date" placeholder="选择日期"></el-date-picker>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">结束日期</label>
                        <div class="layui-input-inline">
                            <el-date-picker v-model="ashUseData.ASHENDDATE" type="date" placeholder="选择日期"></el-date-picker>
                        </div>
                    </div>
                    <div class="layui-inline" v-if="showjbr">
                    <label class="layui-form-label">寄存经办人</label>
                    <div class="layui-input-inline">
                        <el-select v-model="ashUseData.ASHCHKUSR" placeholder="请选择经办人" style="width:100%">
                        <el-option v-for="item in assjbr" :key="item.value" :label="item.label" :value="item.value">
                        </el-option>
                        </el-select>
                    </div>
                   </div>
                    <div class="layui-inline" v-if="showjbrlh">
                    <label class="layui-form-label" style="width:100px">存入经办人</label>
                    <div class="layui-input-inline">
                      <el-input v-model="ashUseData.ASHCHKUSR" placeholder="请输入存入经办人"></el-input>
                    </div>
                   </div>
                     <div class="layui-inline" v-if="showjbrlh&&ccjbrlh">
                    <label class="layui-form-label">取出经办人</label>
                    <div class="layui-input-inline">
                      <el-input v-model="ashUseData.ASHTAKEUSR" placeholder="请输入取出经办人"></el-input>
                    </div>
                   </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">备注</label>
                        <div class="layui-input-inline">
                            <el-input type="textarea" v-model="ashUseData.ASHREMARKS" style="width:768px;"></el-input>
                        </div>
                    </div>
                </div>
                </div>
            </fieldset>
            <div class="layui-form-item btnCenter">
                <el-button @click="cancels">取消</el-button>
                <el-button type="primary" @click="submit">提交</el-button>
                <el-button v-if="isshowdy" type="primary" @click="ywdayin">打印</el-button>
            </div>
        </sweet-modal>
        <!-- 登记 -->
        <sweet-modal ref="reg" class="dialog" :sweetModalMaxWidth="930">
            <h3>{{title}} </h3>
            <fieldset class="layui-elem-field layui-field-title">
                <legend>死者信息</legend>
                <div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">逝者姓名</label>
                        <div class="layui-input-inline">
                            <el-input v-model="ashUseData.ASHNAME" placeholder="请输入逝者姓名"></el-input>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">性别</label>
                        <div class="layui-input-inline">
                            <el-select v-model="ashUseData.ASHSEX" placeholder="请选择逝者性别" filterable>
                                <el-option v-for="item in xblx" :key="item.CODNAME" :label="item.CODALIAS" :value="item.CODNAME">
                                </el-option>
                            </el-select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">年龄</label>
                        <div class="layui-input-inline">
                            <el-input-number v-model="ashUseData.ASHAGE" :min="0"></el-input-number>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">证件号码</label>
                        <div class="layui-input-inline">
                            <el-input v-model="ashUseData.ASHCARDNO" placeholder="请输入证件号码"></el-input>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">逝者地址</label>
                        <div class="layui-input-inline">
                            <el-input v-model="ashUseData.ASHDETAILADDRESS" placeholder="请输入逝者地址" style="width:480px;"></el-input>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item" v-if="IsShowRegcreurn&&!IslinRegcreurn">
                    <div class="layui-inline">
                        <label class="layui-form-label">骨灰盒</label>
                        <div class="layui-input-inline">
                            <el-input v-model="ashUseData.ASHCREURN" readonly></el-input>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item" v-if="IslinRegcreurn">
                    <div class="layui-inline">
                        <label class="layui-form-label">骨灰盒</label>
                        <div class="layui-input-inline">
                            <el-input v-model="ashUseData.ASHCREURN"></el-input>
                        </div>
                    </div>
                </div>
                <!-- <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">备注</label>
                        <div class="layui-input-inline">
                            <el-input v-model="regList.REGREMARK" readonly></el-input>
                        </div>
                    </div>
                </div> -->
                </div>
            </fieldset>
            <fieldset class="layui-elem-field layui-field-title">
                <legend>家属信息</legend>
                <div>
                    <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">家属姓名</label>
                        <div class="layui-input-inline">
                            <el-input v-model="ashUseData.ASHHANDLERNAME" placeholder="请输入家属姓名"></el-input>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">联系电话</label>
                        <div class="layui-input-inline">
                            <el-input v-model="ashUseData.ASHHANDLERLINK" placeholder="请输入联系电话"></el-input>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">逝者关系</label>
                        <div class="layui-input-inline">
                            <el-select v-model="ashUseData.ASHRELATION" editable="true" filterable allow-create default-first-option placeholder="请选择逝者关系">
                                <el-option v-for="item in REGRELATIONOptions" :key="item.value" :label="item.label" :value="item.value">
                                </el-option>
                            </el-select>
                        </div>
                    </div>
                    </div>
                    <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">详细住址</label>
                        <div class="layui-input-inline">
                            <el-input v-model="ashUseData.ASHHANDLERHOUSEHOLD" placeholder="请输入家属详细地址" style="width:480px;"></el-input>
                        </div>
                    </div>
                    </div>
                <!-- <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">备注</label>
                        <div class="layui-input-inline">
                            <el-input type="textarea" v-model="ashUseData.ASHREMARKS" style="width:480px;"></el-input>
                        </div>
                    </div>
                </div> -->
                </div>
            </fieldset>
            <fieldset class="layui-elem-field layui-field-title">
                <legend>寄存堂信息</legend>
                <div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">寄存位置</label>
                        <div class="layui-input-inline">
                            <el-select filterable :disabled="selectstatus" v-model="ashUseData.ASSNO" placeholder="请选择寄存位置" style="width:100%">
                                <el-option v-for="item in ashTypes" :key="item.value" :label="item.label" :value="item.value">
                                </el-option>
                            </el-select>
                        </div>
                        <div class="layui-input-inline" style="width:60px;">
                            <el-button type="primary" icon="el-icon-more" :disabled="selectstatus" @click="openchoosejct"></el-button>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">寄存卡号</label>
                        <div class="layui-input-inline">
                            <el-input v-model="ashUseData.ASHNUMBER" placeholder="请输入寄存卡号"></el-input>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">开始日期</label>
                        <div class="layui-input-inline">
                            <el-date-picker v-model="ashUseData.ASHBEGDATE" type="date" placeholder="选择日期"></el-date-picker>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">结束日期</label>
                        <div class="layui-input-inline">
                            <el-date-picker v-model="ashUseData.ASHENDDATE" type="date" placeholder="选择日期"></el-date-picker>
                        </div>
                    </div>
                   <div class="layui-inline" v-if="showjbr">
                    <label class="layui-form-label">寄存经办人</label>
                    <div class="layui-input-inline">
                        <el-select v-model="ashUseData.ASHCHKUSR" placeholder="请选择经办人" style="width:100%">
                        <el-option v-for="item in assjbr" :key="item.value" :label="item.label" :value="item.value">
                        </el-option>
                        </el-select>
                    </div>
                   </div>
                    <div class="layui-inline" v-if="showjbrlh">
                    <label class="layui-form-label" style="width:100px">存入经办人</label>
                    <div class="layui-input-inline">
                      <el-input v-model="ashUseData.ASHCHKUSR" placeholder="请输入存入经办人"></el-input>
                    </div>
                   </div>
                    <div class="layui-inline" v-if="showjbrlh&&ccjbrlh">
                    <label class="layui-form-label">取出经办人</label>
                    <div class="layui-input-inline">
                      <el-input v-model="ashUseData.ASHTAKEUSR" placeholder="请输入取出经办人"></el-input>
                    </div>
                   </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">备注</label>
                        <div class="layui-input-inline">
                            <el-input type="textarea" v-model="ashUseData.ASHREMARKS" style="width:768px;"></el-input>
                        </div>
                    </div>
                </div>
                </div>
            </fieldset>
            <div class="layui-form-item btnCenter">
                <el-button @click="cancels">取消</el-button>
                <el-button type="primary" @click="submit">提交</el-button>
            </div>
        </sweet-modal>
        <!-- 详情**************************************************************************************************************************************** -->
        <sweet-modal v-if="true" ref="info" class="dialog" :sweetModalMaxWidth="930">
            <h3>{{title}} </h3>
            <fieldset class="layui-elem-field layui-field-title">
                <legend>死者信息</legend>
                <div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">业务编号</label>
                        <div class="layui-input-inline">
                            <el-input v-model="ashUseData.REGBUSNUM" placeholder="请输入业务编号" readonly></el-input>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">逝者姓名</label>
                        <div class="layui-input-inline">
                            <el-input v-model="ashUseData.ASHNAME" readonly></el-input>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">性别</label>
                        <div class="layui-input-inline">
                            <el-input v-model="ashUseData.ASHSEXDESC" readonly></el-input>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">年龄</label>
                        <div class="layui-input-inline">
                            <el-input v-model="ashUseData.ASHAGE" readonly></el-input>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">证件号码</label>
                        <div class="layui-input-inline">
                            <el-input v-model="ashUseData.ASHCARDNO" readonly></el-input>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">逝者地址</label>
                        <div class="layui-input-inline">
                            <el-input v-model="ashUseData.ASHDETAILADDRESS" readonly style="width:480px;"></el-input>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item" v-if="IsShowRegcreurn">
                    <div class="layui-inline">
                        <label class="layui-form-label">骨灰盒</label>
                        <div class="layui-input-inline">
                            <el-input v-model="ashUseData.REGCREURN" readonly></el-input>
                        </div>
                    </div>
                </div>
                <!-- <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">备注</label>
                        <div class="layui-input-inline">
                            <el-input v-model="regList.REGREMARK" readonly></el-input>
                        </div>
                    </div>
                </div> -->
                </div>
            </fieldset>
            <fieldset class="layui-elem-field layui-field-title">
                <legend>家属信息</legend>
                <div>
                    <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">家属姓名</label>
                        <div class="layui-input-inline">
                            <el-input v-model="ashUseData.ASHHANDLERNAME" readonly></el-input>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">联系电话</label>
                        <div class="layui-input-inline">
                            <el-input v-model="ashUseData.ASHHANDLERLINK" readonly></el-input>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">逝者关系</label>
                        <div class="layui-input-inline">
                            <el-input v-model="ashUseData.ASHRELATION" readonly></el-input>
                        </div>
                    </div>
                    </div>
                    <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">详细住址</label>
                        <div class="layui-input-inline">
                            <el-input v-model="ashUseData.ASHHANDLERHOUSEHOLD" readonly style="width:480px;"></el-input>
                        </div>
                    </div>
                    </div>
                <!-- <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">备注</label>
                        <div class="layui-input-inline">
                            <el-input type="textarea" v-model="ashUseData.ASHREMARKS" style="width:480px;"></el-input>
                        </div>
                    </div>
                </div> -->
                </div>
            </fieldset>
            <fieldset class="layui-elem-field layui-field-title">
                <legend>寄存堂信息</legend>
                <div>
                    <!-- <div class="layui-inline">
                        <label class="layui-form-label">寄存位置</label>
                        <div class="layui-input-inline">
                            <el-select filterable :disabled="selectstatus" v-model="ashUseData.ASSNO" placeholder="请选择寄存位置" style="width:100%">
                                <el-option v-for="item in ashTypes" :key="item.value" :label="item.label" :value="item.value">
                                </el-option>
                            </el-select>
                        </div>
                    </div> -->
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">骨灰堂</label>
                        <!-- <div class="layui-input-inline">
                            <el-input v-model="ashUseData.ASSNO" readonly></el-input>
                        </div> -->
                        <div class="layui-input-inline">
                            <el-select filterable :disabled="true" v-model="ashUseData.ASSNO" placeholder="请选择寄存位置" style="width:100%">
                                <el-option v-for="item in ashTypes" :key="item.value" :label="item.label" :value="item.value">
                                </el-option>
                            </el-select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">寄存卡号</label>
                        <div class="layui-input-inline">
                            <el-input v-model="ashUseData.ASHNUMBER" readonly></el-input>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">开始日期</label>
                        <div class="layui-input-inline">
                            <el-input v-model="ashUseData.ASHBEGDATES" readonly></el-input>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                   <div class="layui-inline">
                        <label class="layui-form-label">结束日期</label>
                        <div class="layui-input-inline">
                            <el-input v-model="ashUseData.ASHENDDATES" readonly></el-input>
                        </div>
                    </div>
                    <div class="layui-inline" v-if="showjbr">
                    <label class="layui-form-label">寄存经办人</label>
                    <div class="layui-input-inline">
                     <el-input v-model="ashUseData.ASHCHKUSR" readonly></el-input>
                    </div>
                   </div>
                    <div class="layui-inline" v-if="showjbrlh">
                    <label class="layui-form-label" style="width:100px">存入经办人</label>
                    <div class="layui-input-inline">
                      <el-input v-model="ashUseData.ASHCHKUSR" placeholder="请输入存入经办人" readonly></el-input>
                    </div>
                   </div>
                    <div class="layui-inline" v-if="showjbrlh&&ccjbrlh">
                    <label class="layui-form-label">取出经办人</label>
                    <div class="layui-input-inline">
                      <el-input v-model="ashUseData.ASHTAKEUSR" placeholder="请输入取出经办人" readonly></el-input>
                    </div>
                   </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">备注</label>
                        <div class="layui-input-inline">
                            <el-input type="textarea" v-model="ashUseData.ASHREMARKS" style="width:768px;" readonly></el-input>
                        </div>
                    </div>
                </div>
                </div>
            </fieldset>
            <div class="layui-form-item btnCenter">
                <el-button @click="cancels">取消</el-button>
            </div>
        </sweet-modal>
        <!-- 图形化选取寄存位置************************************************************************************************************************************************** -->
        <sweet-modal ref="choosejct" class="dialog" :sweetModalMaxWidth="1200">
            <div class="header-form">
                <label class="layui-form-label">寄存区域</label>
                <div class="layui-inline">
                    <el-select v-model="icaSelectIndex" placeholder="请选择" @change="getAssData">
                        <el-option v-for="item in areaTypes" :key="item.value" :label="item.label" :value="item.value">
                        </el-option>
                    </el-select>
                </div>
                <div class="layui-inline">
                    <el-button type="primary" @click="getAssData">刷新</el-button>
                </div>
                <div class="layui-inline" style="line-height:40px;margin-left:300px;">
                    <div style="float:right;">
                        <div style="width:30px;height:20px;background:#eb9e05;float:right;margin-top:10px;border-radius:5px;"></div>
                        <span style="float:right;">已存入</span>
                    </div>
                    <div style="float:right;margin-right:20px;">
                        <div style="width:30px;height:20px;background:#67c23a;float:right;margin-top:10px;border-radius:5px;"></div>
                        <span style="float:right;">未存入</span>
                    </div>
                </div>
            </div>
             <!-- 寄存堂图 -->
            <div class="tableContainer" style="position: relative">
                <div v-for="y in iceAreaItem.ASAYCOUNT" :style="{width:iceAreaItem.ASAXCOUNT*left+'px',height:top}" style="clear:left">
                    <div v-for="x in iceAreaItem.ASAXCOUNT" class="iceplace iceplacedefault"></div>
                </div>
                <ul class="tableIceArea">  
                    <li v-for="(item, index) in AssAreaInfo" @click="returndata(item)" :style="{left: (left*(item.ASSXP-1)) + 'px', top: (top*(item.x-item.ASSYP)) + 'px' }" style=" position: absolute;">
                        <div class="listCenter" :class="setDivClass(item)">
                            <p v-text="item.ASSNO" class="itemNo">0</p>
                            <div class="iceName">
                                {{item.REGNAME}}
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
        </sweet-modal>
        <!-- 义乌寄存堂使用续存页面******************************************************************************************************************************* -->
        <sweet-modal ref="newcontinue" class="dialog" :sweetModalMaxWidth="800">
            <h3>{{title}}</h3>
            <div :style="{maxHeight:maxHeight+'px'}" style="overflow:auto;margin-right:20px;">
                <table class="layui-table" style="border-spacing: 0;">
                    <colgroup>
                        <col>
                        <col>
                        <col>
                        <col width="100">
                    </colgroup>
                    <thead>
                        <tr>
                            <th>开始时间</th>
                            <th>结束时间</th>
                            <th>备注</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody ref='inputs'>
                        <tr class="allRow" v-for="(chl,index) in chlList">
                             <td>
                                <div class="layui-input-inline chooseTime">
                                    <el-date-picker style="width:115px;float:left;" :disabled='chl.ISOLD' clear-icon="null" type="date" v-date v-model="chl.ASHBEGDATE"></el-date-picker>
                                </div>
                            </td>
                            <td>
                                <div class="layui-input-inline chooseTime">
                                    <el-date-picker style="width:115px;float:left;" :disabled='chl.ISOLD' clear-icon="null" type="date" v-date v-model="chl.ASHENDDATE"></el-date-picker>
                                </div>
                            </td>
                            <td>
                                <!-- 备注 -->
                                <el-input v-model="chl.ASHREMARKS" :disabled='chl.ISOLD'></el-input>
                            </td>
                            <td>
                                <!-- 操作 -->
                                <button class="layui-btn layui-btn-small layui-btn-normal" :disabled='chl.ISOLD' @click="remove(index)">
                                    <i class="layui-icon">&#xe640;</i>
                                </button>
                            </td>
                        </tr>
                    </tbody>
                    <tfoot>
                        <tr>
                        <td colspan="3">
                           
                        </td>
                        <td>
                            <button class="layui-btn layui-btn-small layui-btn-normal" @click="insert()">
                                <i class="layui-icon">&#xe654;</i>
                            </button>
                        </td>
                        </tr>
                    </tfoot>
                </table>
            </div>
            <div class="layui-form-item btnCenter">
                <el-button @click="cancels">取消</el-button>
                <el-button type="primary" @click="submit">提交</el-button>
            </div>
        </sweet-modal>
        <checkout-add ref="checkoutAdd"></checkout-add>

    </div>
</template>

<style rel="stylesheet/scss" lang="scss" scoped>
    div.tableContainer {
    width: 100%;
    max-height: 650px;
    overflow: auto;
    margin-top: 20px;
    ul.tableIceArea {
        overflow: hidden;
        width: 100%;
        height: 100%;
        li {
        width: 100px;
        height: 100px;
        div.listCenter {
            p.itemNo {
            text-align: center;
            padding-top: 15px;
            font-size: 18px;
            color: white;
            font-weight: bold;
            }
            div.iceName {
            height: 40px;
            width: 100%;
            text-align: center;
            padding-top: 15px;
            font-size: 18px;
            color: white;
            font-weight: bold;
            }
            div.tableToolList {
            overflow: hidden;
            ul.tableTool {
                width: 90px;
                margin: 10px auto 0;
                overflow: hidden;
                height: 30px;
                li {
                float: left;
                width: 30px;
                height: 30px;
                text-align: center;
                line-height: 30px;
                padding: 0;
                margin: 0;
                cursor: pointer;
                position: inherit;
                }
                li.saveBtn {
                background: #009289;
                color: white;
                }
                li.takeBtn {
                // background: #eaeaea;
                background: #ff2021;
                color: white;
                }
                li.takeBtnEnadble {
                // background: #eaeaea;
                background: #eef1f6;
                color: #878d99;
                cursor: not-allowed;
                }
                li.moreBtn {
                background: #ef9000;
                color: white;
                span.el-dropdown-link {
                    color: white;
                }
                }
            }
            }
        }
        }
    }
    }
    .iceplace {
        margin: 5px;
        width: 100px;
        height: 100px;
        float: left;
    }
    .iceplacedefault {
        background-color: #878d99;
    }
    .iceplaceCanuse {
        background-color: #67c23a;
    }
    .iceplaceUseed {
        background-color: #eb9e05;
    }
    .iceplaceMoreUseed {
        background-color: #fa5555;
    }

</style>
<script>
    import { ORDER } from "@/const/orderConst.js";
    import sweetModal from "@/components/sweetModal";
    import dataTable from "@/components/Table/DataTable";
    import apiBase from "@/api/apiBase.js";
    import checkoutAdd from "@/views/businessHall/checkoutAdd";
    import {
        formatDate,
        timeStringToDate,
        dateStringToDate
    } from "@/utils/date.js";
    import {
        manage
    } from "@/mixins/managePage.js";
    const ADD = "新增";
    const MODIFY = "修改";
    const DELETE = "删除";
    const INFO = "详情";
    const END = "结束使用";
    const BEG = "开始使用";
    const REG = "登记";
    const CONTINUE = "使用续存";
    const TOBESTORED = 'X';
    export default {
        name: "assUseMain",
        mixins: [manage],
        data() {
            return {
                ASHID:null, //义乌返回值接收
                REGID:null,
                ccjbrlh:null, //寄存堂使用是否显示取出经办人(临海)
                showjbrlh:null, //寄存堂使用是否显示经办人(临海)
                showjbr:null, //寄存堂使用是否显示经办人(上虞)
                regCheckDate: null,  //宁波新加选择逝者
                regCheckList:null,   //宁波新加选择逝者
                pageWidth: 1200,
                maxHeight: 500,
                ashUseData: {
                    ASSNO: null,
                    ASHREGID: null,
                    ASHRELATION:"",
                },
                REGRELATIONOptions: [], //逝者关系下拉
                regList: {},
                statusTypes: {},
                ashTypes: [],
                assjbr: [], //经办人下拉集合
                xblx:[],
                selectstatus: null,
                IsShowRegcreurn: null,
                IslinRegcreurn: null,  //临海个性化需求 可输入骨灰盒
                icaSelectIndex: null,//寄存区域
                areaTypes: [],
                iceAreaItem: {
                    ICAID: null
                },
                left: "110",
                top: "110",
                AssAreaInfo: [], //获取寄存区域的寄存堂及使用信息
                dataobj: null,
                chlList: [],
                chl: {
                    ASHBEGDATE: null,
                    ASHENDDATE: null,
                    ASHREMARKS: null,
                },
                isshowdy: false,
                ywghjc: true,
            }
        },
        methods: {
            async open(order, obj, REGNOS) {
                this.order = order;
                this.dataobj = obj;
                await this.getCrhs(obj);
                this.selectstatus = false;
                this.isshowdy = false;
                switch (this.order) {
                    case ADD:
                        this.title = "寄存堂使用新增";
                        this.dataRepeat();
                        this.ashUseData.ASHBEGDATE = new Date();
                        if(this.showjbrlh==true){
                        this.ashUseData.ASHCHKUSR = localStorage.getItem("name");
                        }
                        this.$refs.dialog.open();
                        break;
                    case REG:
                        this.title = "寄存堂使用登记";
                        this.dataRepeat();
                        if(this.showjbrlh==true){
                        this.ashUseData.ASHCHKUSR = localStorage.getItem("name");
                        }
                        this.$refs.reg.open();
                        break;
                    case MODIFY:
                        this.selectstatus = false;
                        this.title = "寄存堂使用修改";
                        if(obj.ASHID == undefined){
                            this.dataInfo(obj.AssUse[0].ASHID);
                        }else{
                            this.dataInfo(obj.ASHID);
                        }
                        if(obj.REGBUSNUM === ''){
                            this.$refs.reg.open();
                        }else{
                            this.$refs.dialog.open();
                        }
                        break;
                    case INFO:
                        this.selectstatus = true;
                        this.title = "寄存堂使用详情";
                        if(obj.ASHID == undefined){
                            this.dataInfo(obj.AssUse[0].ASHID);
                        }else{
                            this.dataInfo(obj.ASHID);
                        }
                        this.$refs.info.open();
                        break;
                    case BEG:
                        this.title = "寄存堂开始使用";
                        this.dataRepeat();
                         if(this.showjbrlh==true){
                        this.ashUseData.ASHCHKUSR = localStorage.getItem("name");
                        }
                        this.ashUseData.ASHBEGDATE = new Date();
                        if(obj){
                            this.ashUseData.ASSNO = obj.ASSID;
                            this.selectstatus = true;
                        }
                        this.$refs.dialog.open();
                        break;
                    case END:
                        this.ccjbrlh=true
                        this.selectstatus = true;
                        this.title = "寄存堂结束使用";
                        if(obj.ASHID == undefined){
                            this.dataInfo(obj.AssUse[0].ASHID);
                        }else{
                            this.dataInfo(obj.ASHID);
                        }
                        if(obj.REGBUSNUM === ''){
                            this.$refs.reg.open();
                        }else{
                            this.$refs.dialog.open();
                        }
                        break;
                    case CONTINUE:
                        this.selectstatus = true;
                        this.title = "寄存堂使用续存";
                        if(obj.ASHID == undefined){
                            this.dataInfo(obj.AssUse[0].ASHID);
                        }else{
                            this.dataInfo(obj.ASHID);
                        }
                        this.$refs.dialog.open();
                        break;
                    case '新使用续存':
                        this.selectstatus = true;
                        this.title = "寄存堂使用续存";
                        this.DetailAst(obj.ASHID);
                        this.$refs.newcontinue.open();
                        break;
                    case TOBESTORED:
                        this.selectstatus = false;
                        this.title = "寄存堂开始使用";
                        // this.ashUseData.ASHBEGDATE = new Date();
                       if(this.showjbrlh==true){
                        this.ashUseData.ASHCHKUSR = localStorage.getItem("name");
                        }
                        if(obj.ASHID == undefined){
                            this.dataInfo(obj.AssUse[0].ASHID);
                        }else{
                            this.dataInfo(obj.ASHID);
                        }
                        this.$refs.dialog.open();
                        break;
                    case 'jicun':
                        this.dataRepeat();
                        this.title = "寄存堂开始使用";
                        this.ashUseData.REGBUSNUM = REGNOS;
                        this.getRegInfo();  
                        this.$refs.dialog.open();
                        break;
                    default:
                }
            },
            //提交
            submit() {
                switch (this.order) {
                    case ADD:
                        this.dataAdds();
                        break;
                    case REG:
                        this.dataReg();
                        break;
                    case BEG:
                    case 'jicun':
                    case TOBESTORED:
                        this.dataAdda();
                        break;
                    case MODIFY:
                        this.dataModify();
                        break;
                    case END:
                        this.endUse();
                        break;
                    case CONTINUE:
                        this.dataCon();
                        break;
                    case '新使用续存':
                        this.dataConNew();
                        break;
                    default:
                }
            },
             //获取位置类别
        getIceArea() {
            let data = {};
            apiBase.DoService(
                data,
                apiBase.getApiAdress().Ashes.QueryAshesArea,
                res => {
                    let assTypeData = res.data.content.OutData,
                    legendsUsersData = assTypeData.map(item => ({
                        label: item.ASANAME,
                        value: item.ASAID,
                        ASAXCOUNT: item.ASAXCOUNT,
                        ASAYCOUNT: item.ASAYCOUNT
                    }));
                this.areaTypes = legendsUsersData;
                this.icaSelectIndex = this.areaTypes[0].value;//默认寄存区域
                this.getAssData();
                },
                res => {
                this.$message.error(res.data.msg);
                }
            );
            },
            //获取冰柜区域的冰柜及使用信息
            getAssData() {
                if (
                    this.icaSelectIndex === null ||
                    this.areaTypes === undefined ||
                    this.areaTypes.length == 0
                )
                    return;
                    for(var i = 0;i < this.areaTypes.length;i++){
                        if(this.areaTypes[i].value === this.icaSelectIndex){
                            this.iceAreaItem = this.areaTypes[i];
                        }
                    }
                var data = {
                    //请求体
                    PageIndex: this.pageOrder.currentPage,
                    PageSize: this.pageOrder.pageSize,
                    OrderBy: this.pageOrder.orderType,
                    OrderByType: this.pageOrder.orderSort,
                    ASAID: this.icaSelectIndex,
                };
                apiBase.DoService(
                    data,
                    apiBase.getApiAdress().AshesUse.QueryAssUseByArea, 
                    res => {  
                    this.AssAreaInfo = res.data.content.List_Asa;
                    this.AssAreaInfo.forEach((item, index) => {  
                        item.x = res.data.content.ASAYCOUNT;
                        if (item.AssUse !== undefined && item.AssUse.length > 0){
                            this.GetIchInfo(item);
                            item.REGNAME = item.AssUse[0].REGNAME;
                        } else item.REGNAME = "";
                    });
                    }
                );
            },
             //新增行
            insert() {
                // for (let index in this.chlList) {
                //     let chl = this.chlList[index];
                //     if (chl.CDHCODNAME === null) {
                //         this.$message({
                //             type: "error",
                //             message: `第${parseInt(index) + 1}行收费项目不能为空!`
                //         });
                //         return false;
                //     }
                // }
                this.chlList.push(JSON.parse(JSON.stringify(this.chl)));
                return true;
            },
            remove(index) {
                this.chlList.splice(index, 1);
            },
            // 控制样式的
            setDivClass(Ass) {
                if (Ass === undefined) return "";
                if (Ass.AssUse === null || Ass.AssUse.length == 0)
                    return "iceplace iceplaceCanuse";
                else if (Ass.AssUse.length == 1) return "iceplace iceplaceUseed";
                else if (Ass.AssUse.length > 1) return "iceplace iceplaceMoreUseed";
            },
             //跳转图形化选取寄存堂位置
            openchoosejct() {
                this.getIceArea();
                this.$refs.choosejct.open();
            },
            returndata(val){
                if(val.AssUse.length >0){
                     this.$message({
                        type: "error",
                        message: "该寄存堂已被占用，不能选用！"
                    });
                    return
                }
                this.ashUseData.ASSNO = val.ASSID;
                this.$refs.choosejct.close();
              
            
           },
           
            //获取编码
            getCode() {
                let data = {};
                apiBase.DoService(
                    data,
                    apiBase.getApiAdress().Registration.QueryAllCode,
                    res => {
                    this.codeList = res.data.content;
                    for (var i in this.codeList) {
                        switch (this.codeList[i].CTPID) {
                        case "性别类型":
                            this.xblx = this.codeList[i].Cods;
                            break;
                        default:
                        }
                    }
                    }
                );
                    //获取经办人下拉
                apiBase.DoService(
                {
                   STACODNAME:"寄存人员"
                },
                apiBase.getApiAdress().User.QueryUsrAll,
                res => {
                    let mehTypeData = res.data.content,
                        legendsashUseData = mehTypeData.map(item => ({
                            label: item.USRNAME,
                            value: item.USRNAME
                        }));
                    this.assjbr = legendsashUseData;
                }
                );
            },
            //获取骨灰堂
            getCrhs(obj) {
                let data = {};
                if(obj != undefined){
                    data = {
                        ASHREGID: obj.REGID,
                    };
                }else{
                    data = {};
                }
                return new Promise((resolve)=>{
                    apiBase.DoService(
                        data,
                        apiBase.getApiAdress().AshesUse.QueryAshes,
                        res => {
                            let assTypeData = res.data.content,
                                legendsUsersData = assTypeData.map(item => ({
                                    label: item.ASSNAME,
                                    value: item.ASSID
                                }));
                            this.ashTypes = legendsUsersData;
                            resolve()
                        });
                })
            },
            GetIchInfo(item) {
                if(item.AssUse[0].REGBUSNUM === "") return;
                let data = {
                    ASHASSID: item.ASSID,
                    REGBUSNUM: item.AssUse[0].REGBUSNUM
                };
                apiBase.DoService(
                    data,
                    apiBase.getApiAdress().AshesUse.GetRegistrationAndUseByNo,
                    res => {
                    if(res.data.content.ASH){
                        item.ASHID = res.data.content.ASH.ASHID;
                    }
                    }
                );
            },
            //获取状态
            getStatus() {
                let data = {};
                apiBase.DoService(
                    data,
                    apiBase.getApiAdress().AshesUse.GetAshStatus,
                    res => {
                        let assTypeData = res.data.content,
                            legendsUsersData = assTypeData.map(item => ({
                                label: item.Text,
                                value: item.Value
                            }));
                        this.statusTypes = legendsUsersData;
                    });
            },
            //根据正式业务编号获取ID
            getRegInfo() {
                // let Data = JSON.parse(JSON.stringify(this.ashUseData));
                let data = {
                    REGNO: this.ashUseData.REGBUSNUM  
                };
                apiBase.DoService(
                    data,
                    apiBase.getApiAdress().Registration.GetRegistrationByNo,
                    res => {
                        let reg = res.data.content;
                        if(!reg)
                            {
                                this.$message({
                                type: "error",
                                message: "未找到逝者信息!"
                            });
                            Object.assign(
                                this.$data.regList,
                                this.$options.data().regList
                            );
                             return;
                            }
                        this.regList = reg;
                        this.ashUseData.REGID = reg.REGID;
                    }
                );
            },
            //数据重置
            dataRepeat() {
                this.ashUseData = {
                    ASSNO: null,
                    ASHREGID: null,
                    ASHBEGDATE: null,
                    ASHRELATION:"",
                };
                this.regList = {};
                this.ccjbrlh=false
            },
            //新增
            dataAdd() {
                let Data = JSON.parse(JSON.stringify(this.ashUseData));
                if (Data.ASHBEGDATE)
                    Data.ASHBEGDATE = formatDate(Data.ASHBEGDATE, "yyyyMMdd");
                if (Data.ASHENDDATE)
                    Data.ASHENDDATE = formatDate(Data.ASHENDDATE, "yyyyMMdd");
                Data.ASHASSID = this.ashUseData.ASHASSID;
                if(this.dataobj == undefined){
                    Data.ASHREGID = this.regList.REGID;
                }else{
                    Data.ASHREGID = this.ashUseData.REGID;
                }
                if(this.IslinRegcreurn){    //临海 骨灰盒可输入传值
                  Data.REGCREURN=this.regList.REGCREURN
                }
                // Data.ASHREGID = this.regList.REGID;
                apiBase.DoService(
                    Data,
                    apiBase.getApiAdress().AshesUse.StartUse,
                    res => {
                        this.refreshData();
                        this.$refs.dialog.close();
                        this.$message({
                            message: this.order + res.data.msg,
                            type: "success"
                        });
                    });
            },
             //待寄存开始使用
            dataAdda() {
                let Data = JSON.parse(JSON.stringify(this.ashUseData));
                if (Data.ASHBEGDATE)
                    Data.ASHBEGDATE = formatDate(Data.ASHBEGDATE, "yyyyMMdd");
                if (Data.ASHENDDATE)
                    Data.ASHENDDATE = formatDate(Data.ASHENDDATE, "yyyyMMdd");
                if(this.ashUseData.ASSNO){
                    if(this.ashUseData.ASSNO.length < 5){
                        for(var i = 0;i <  this.ashTypes.length;i++){
                            if(this.ashTypes[i].label == this.ashUseData.ASSNO){
                                Data.ASHASSID = this.ashTypes[i].value;
                            }
                        }
                    }else{
                        Data.ASHASSID = this.ashUseData.ASSNO;
                    }
                }
                if(this.IslinRegcreurn){      //临海 骨灰盒可输入传值
                  Data.REGCREURN=this.regList.REGCREURN
                }
                if(this.dataobj == undefined){
                    Data.ASHREGID = this.regList.REGID;
                }else{
                    // if(this.regList.REGID != null){
                    //     Data.ASHREGID = this.regList.REGID;
                    // }
                    // if(this.ashUseData.REGID != undefined){
                    //     Data.ASHREGID = this.ashUseData.REGID;
                    // }
                    
                    Data.ASHREGID = this.ashUseData.REGID;
                }
                apiBase.DoService(
                    Data,
                    apiBase.getApiAdress().AshesUse.StartUse,
                    res => {
                        this.refreshData();
                        if(this.ywghjc = true){
                            this.REGID=res.data.content.REGID;  
                            this.ASHID=res.data.content.ASHID;  
                            this.isshowdy = true;
                        }else{
                            this.$refs.dialog.close();
                        }
                        this.$refs.reg.close();
                        this.$refs.dialog.close();
                        this.$message({
                            message: '开始使用' + res.data.msg,
                            type: "success"
                        });
                    },
                    res => {
                        this.$message.error(res.data.msg);
                    });
            },
            ywdayin(){
                this.$emit('assUseMaindy',this.REGID,this.ASHID)
            },
            // 登记
            dataReg() {
                let Data = JSON.parse(JSON.stringify(this.ashUseData));
                if (Data.ASHBEGDATE)
                    Data.ASHBEGDATE = formatDate(Data.ASHBEGDATE, "yyyyMMdd");
                if (Data.ASHENDDATE)
                    Data.ASHENDDATE = formatDate(Data.ASHENDDATE, "yyyyMMdd");
                // if(this.ashUseData.ASSNO.length < 5){
                //     for(var i = 0;i <  this.ashTypes.length;i++){
                //         if(this.ashTypes[i].label == this.ashUseData.ASSNO){
                //             Data.ASHASSID = this.ashTypes[i].value;
                //         }
                //     }
                // }else{
                //     Data.ASHASSID = this.ashUseData.ASSNO;
                // }
                 if(this.IslinRegcreurn){    //临海 骨灰盒可输入传值
                  Data.ASHCREURN=this.ashUseData.ASHCREURN
                }
                Data.ASHASSID = this.ashUseData.ASSNO;
                apiBase.DoService(
                    Data,
                    apiBase.getApiAdress().AshesUse.RegisterStartUse,
                    res => {
                        this.refreshData();
                        this.$refs.reg.close();
                        this.$message({
                            message: this.order + res.data.msg,
                            type: "success"
                        });
                    },
                    res => {
                        this.$message.error(res.data.msg);
                    });
            },
             //补录
            dataAdds() {
                let Data = JSON.parse(JSON.stringify(this.ashUseData));
                if (Data.ASHBEGDATE)
                    Data.ASHBEGDATE = formatDate(Data.ASHBEGDATE, "yyyyMMdd");
                if (Data.ASHENDDATE)
                    Data.ASHENDDATE = formatDate(Data.ASHENDDATE, "yyyyMMdd");
                Data.ASHASSID = this.ashUseData.ASSNO;
                if(this.dataobj == undefined){
                    Data.ASHREGID = this.regList.REGID;
                }else{
                    Data.ASHREGID = this.ashUseData.REGID;
                }
                  if(this.IslinRegcreurn){    //临海 骨灰盒可输入传值
                  Data.REGCREURN=this.regList.REGCREURN
                }
                apiBase.DoService(
                    Data,
                    apiBase.getApiAdress().AshesUse.Create,
                    res => {
                        this.refreshData();
                        this.$refs.dialog.close();
                        this.$message({
                            message: this.order + res.data.msg,
                            type: "success"
                        });
                    },
                    res => {
                        this.$message.error(res.data.msg);
                    });
            },
            //详情
            dataInfo(id) {
                var data = {
                    ASHID: id
                };
                apiBase.DoService(
                    data,
                    apiBase.getApiAdress().AshesUse.Detail,    
                    res => {
                        this.ashUseData = res.data.content;
                        this.regList.REGNAME = this.ashUseData.ASHNAME;
                        // this.regList.REGSEXDESC = this.ashUseData.ASHSEX;
                        this.regList.REGSEXDESC = this.ashUseData.ASHSEXDESC;
                        this.regList.REGAGE = this.ashUseData.ASHAGE;
                        this.regList.REGCARDNO = this.ashUseData.ASHCARDNO;
                        this.regList.REGDETAILADDRESS = this.ashUseData.ASHDETAILADDRESS;
                        this.regList.REGHANDLERHOUSEHOLD = this.ashUseData.ASHHANDLERHOUSEHOLD;
                        this.regList.REGRELATION = this.ashUseData.ASHRELATION;
                        this.regList.REGHANDLERNAME = this.ashUseData.ASHHANDLERNAME;
                        this.regList.REGHANDLERLINK = this.ashUseData.ASHHANDLERLINK;
                        this.regList.REGREMARK = this.ashUseData.ASHREMARKS;
                        this.regList.REGCREURN = this.ashUseData.REGCREURN;
                        this.ashUseData.ASHCREURN = this.ashUseData.REGCREURN; //补录（临海 ） 配置 登记 修改显示
                        this.ashUseData.ASHBEGDATES = res.data.content.ASHBEGDATE;
                        this.ashUseData.ASHCHKUSR = this.ashUseData.ASHCHKUSR;  //经办人 （上虞）
                        if(this.order == 'X'){
                            if(res.data.content.ASHBEGDATE==""){ //推送过来的数据添加开始日期
                                this.ashUseData.ASHBEGDATE = new Date();
                            };
                        }; 
                        if(this.showjbrlh==true){
                            if(this.order==END){
                            this.ashUseData.ASHTAKEUSR = localStorage.getItem("name");
                            }
                        }
                        this.ashUseData.ASHENDDATES = res.data.content.ASHENDDATE;
                        this.ashUseData.ASHREGID = this.ashUseData.REGID;
                        if(this.selectstatus){
                            this.ashUseData.ASSNO = this.ashUseData.ASSNO;
                        }else{
                            let bol = this.ashTypes.some((val)=>{
                                return val.value == this.ashUseData.ASHASSID
                            })
                            if(!bol){
                                this.ashTypes.push({
                                    value: this.ashUseData.ASHASSID,
                                    label: this.ashUseData.ASSNO
                                })
                            }
                            this.ashUseData.ASSNO = this.ashUseData.ASHASSID;
                        }
                        // ashUseData.ASSNO
                    });
            },
            //使用续存
            dataCon() {
                let Data = JSON.parse(JSON.stringify(this.ashUseData));
                if (Data.ASHBEGDATE)
                    Data.ASHBEGDATE = formatDate(Data.ASHBEGDATE, "yyyyMMdd");
                if (Data.ASHENDDATE)
                    Data.ASHENDDATE = formatDate(Data.ASHENDDATE, "yyyyMMdd");
                let data = {
                    ASHID: Data.ASHID,
                    ASHBEGDATE: Data.ASHBEGDATE,
                    ASHREGID: Data.REGID,
                    ASHENDDATE: Data.ASHENDDATE,
                    ASHASSID: Data.ASHASSID,
                    ASHREMARKS: Data.ASHREMARKS,
                };
                apiBase.DoService(
                    data,
                    apiBase.getApiAdress().AshesUse.ConUse,
                    res => {
                        this.refreshData();
                        this.$refs.dialog.close();
                        this.$refs.reg.close();
                        this.$message({
                            message: this.order + res.data.msg,
                            type: "success"
                        });
                    },
                    res => {
                        this.$message.error(res.data.msg);
                    });
            },
            //使用续存(新)
            dataConNew() {
                let chldata = JSON.parse(JSON.stringify(this.chlList));
                let Data = chldata[chldata.length-1];
                if (Data.ASHBEGDATE)
                    Data.ASHBEGDATE = formatDate(Data.ASHBEGDATE, "yyyyMMdd");
                if (Data.ASHENDDATE)
                    Data.ASHENDDATE = formatDate(Data.ASHENDDATE, "yyyyMMdd");
                let data = {
                    ASHID: this.dataobj.ASHID,
                    ASHBEGDATE: Data.ASHBEGDATE,
                    ASHREGID: this.dataobj.REGID,
                    ASHENDDATE: Data.ASHENDDATE,
                    ASHREMARKS: Data.ASHREMARKS
                };
                apiBase.DoService(
                    data,
                    apiBase.getApiAdress().AshesUse.ConUse,
                    res => {
                        this.refreshData();
                        this.$refs.newcontinue.close();
                        this.$refs.checkoutAdd.open('续存',res.data.content.REGBUSNUM);
                        this.$message({
                            message: this.order + res.data.msg,
                            type: "success"
                        });
                    },
                    res => {
                        this.$message.error(res.data.msg);
                    });
            },
            //获取骨灰续存明细数据
            DetailAst(id) {
                let data = {
                    ASHID: id
                }
                apiBase.DoService(
                    data,
                    apiBase.getApiAdress().AshesUse.DetailAst, 
                    res => {
                        let detaildata = res.data.content;
                        this.chlList = res.data.content;
                        detaildata.forEach((item,i) => {
                            this.chlList[i].ASHBEGDATE = dateStringToDate(//开始时间
                                item.ASTBEGDATE 
                            );
                            this.chlList[i].ASHENDDATE = dateStringToDate(//结束时间
                                item.ASTENDDATE 
                            );
                            this.chlList[i].ASHREMARKS = item.ASTREMARKS;
                            this.chlList[i].ISOLD = item.ISOLD;
                        })
                    },
                    res => {
                        this.$message.error(res.data.msg);
                    });
            },
            //修改
            dataModify() {
                let Data = JSON.parse(JSON.stringify(this.ashUseData));
                if (Data.ASHBEGDATE)
                    Data.ASHBEGDATE = formatDate(Data.ASHBEGDATE, "yyyyMMdd");
                if (Data.ASHENDDATE)
                    Data.ASHENDDATE = formatDate(Data.ASHENDDATE, "yyyyMMdd");
                if (Data.ASHCHKDATE)
                    Data.ASHCHKDATE = formatDate(Data.ASHCHKDATE, "yyyyMMdd");
                if (Data.ASHTAKDATE)
                    Data.ASHTAKDATE = formatDate(Data.ASHTAKDATE, "yyyyMMdd");
                if(this.IslinRegcreurn){    //临海 骨灰盒可输入传值
                  Data.REGCREURN=this.regList.REGCREURN
                }
                Data.ASHASSID = Data.ASSNO
                
                let data = {
                    ASHID: Data.ASHID,
                    ASHBEGDATE: Data.ASHBEGDATE,
                    ASHENDDATE: Data.ASHENDDATE,
                    ASHNUMBER: Data.ASHNUMBER,
                    ASHREMARKS: Data.ASHREMARKS,
                    ASHCHKUSR: Data.ASHCHKUSR, //经办人
                };
                apiBase.DoService(
                    Data,
                    apiBase.getApiAdress().AshesUse.Modify,
                    res => {
                        this.refreshData();
                        this.$refs.dialog.close();
                        this.$refs.reg.close();
                        this.$message({
                            message: this.order + res.data.msg,
                            type: "success"
                        });
                    },
                    res => {
                        this.$message.error(res.data.msg);
                    });
            },
            //骨灰堂结束使用
            endUse() {
                let Data = JSON.parse(JSON.stringify(this.ashUseData));
                Data.ASHREGID = Data.REGID;
                Data.ASHTAKDATE = formatDate(Date.now(), "yyyyMMdd");
                Data.ASHENDDATE = formatDate(Data.ASHENDDATE, "yyyyMMdd");
                if(this.IslinRegcreurn){    //临海 骨灰盒可输入传值
                  Data.REGCREURN=this.regList.REGCREURN
                }
                apiBase.DoService(
                    Data,
                    apiBase.getApiAdress().AshesUse.EndUse,
                    res => {
                        this.refreshData();
                        this.$refs.dialog.close();
                        this.$refs.reg.close();
                        this.$message({
                            message: "骨灰堂结束使用" + res.data.msg,
                            type: "success"
                        });
                    },
                    res => {
                        this.$message.error(res.data.msg);
                    });
            },
            // 页面关闭
            cancels() {
                this.$refs.reg.close();
                this.$refs.dialog.close();
                this.$refs.info.close();
                this.$refs.newcontinue.close();
            },
            refreshData() {
                this.$emit("refreshData");
            },
        },
        created() {
            this.getCode();
            apiBase.DoService(
            {},
            apiBase.getApiAdress().Code.GetSzgxType,
            res => {
                let SzgxType = res.data.content;
                this.REGRELATIONOptions = SzgxType.map(item => ({
                    label: item.CodeName,
                    value: item.CodeValue
                }));
            }
            );
            //是否显示骨灰盒
            apiBase.DoService(
                {}, 
                apiBase.getApiAdress().Param.GetIsShowRegcreurn, 
                res => {
                this.IsShowRegcreurn = res.data.content;
            });
            //是否显示可输入骨灰盒 （临海）
            apiBase.DoService(
                {}, 
                apiBase.getApiAdress().Param.GetIsInputREGCREURN, 
                res => {
                this.IslinRegcreurn = res.data.content;
            });
            //寄存堂使用是否显示经办人
            apiBase.DoService(
                {}, 
                apiBase.getApiAdress().Param.GetIsShowDepositoryPersonCharge, 
                res => {
                this.showjbr = res.data.content;
            });
            //寄存堂使用是否显示经办人（临海）
            apiBase.DoService(
                {}, 
                apiBase.getApiAdress().Param.GetIsShowAshUsr, 
                res => {
                this.showjbrlh = res.data.content;
            });
            //寄存堂开始使用后页面不关闭，同时显示一个打印按钮（义乌）
            apiBase.DoService(
                {}, 
                apiBase.getApiAdress().Param.GetIsNoClose, 
                res => {
                this.ywghjc = res.data.content;
            });
        },
        components: {
            sweetModal,
            checkoutAdd
        }
    };
</script>

